package com.zyb.utils;

import lombok.Data;

@Data
public class AjaxResult {
    private String msg;
    private Boolean success;
    private Object data;
    private Long total;

    //私有化构造方法
    private AjaxResult() {
    }
    //私有化构造方法
    private AjaxResult(String msg, Boolean success) {
        this.msg = msg;
        this.success = success;
    }

    public static AjaxResult success(){
        return new AjaxResult("成功",true);
    }

   public static AjaxResult error(){
        return new AjaxResult("失败",false);
   }

    public String getMsg() {
        return msg;
    }

    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public boolean isSuccess() {
        return success;
    }

    public AjaxResult setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setData(Object data) {
        this.data = data;
        return this;
    }
    public AjaxResult setTotal(Long total) {
        this.total = total;
        return this;
    }
}
